import com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport;

import java.util.HashMap;
import java.util.Scanner;

class Complex {
    private int RealPart;
    private int VirtualPart;

    public int getRealPart() {
        return RealPart;
    }

    public void setRealPart(int realPart) {
        RealPart = realPart;
    }

    public int getVirtualPart() {
        return VirtualPart;
    }

    public void setVirtualPart(int virtualPart) {
        VirtualPart = virtualPart;
    }

    public Complex(int realPart, int virtualPart) {
        RealPart = realPart;
        VirtualPart = virtualPart;
    }

    public Complex() {
    }

    public Complex add(Complex x) {
        Complex tmp = new Complex();
        tmp.RealPart = this.RealPart + x.RealPart;
        tmp.VirtualPart = this.VirtualPart + x.RealPart;
        return tmp;
    }

    public Complex mul(Complex x) {
        Complex tmp = new Complex();
        tmp.RealPart = this.RealPart * x.RealPart - this.VirtualPart * x.VirtualPart;
        tmp.VirtualPart = this.VirtualPart * x.RealPart + this.RealPart + x.VirtualPart;
        return tmp;
    }
}

public class Test3 {
    public static void main2(String[] args) {
        int r = 0, v = 0;
        //r、v为从键盘获得的整数，请写出该段代码，注意类型，假设这里分别输入3和2
        Scanner scanner = new Scanner(System.in);
        r = scanner.nextInt();
        v = scanner.nextInt();

        //以下内容，请新建一个Complex类，表示数学上的复数
        Complex z1 = new Complex(); //数学上的复数，比如3+2i，其中3表示实部，2表示虚部
        z1.setRealPart(r);  //假设之前输入3和2，这里则是设置该复数的实部为3
        z1.setVirtualPart(v); //假设之前输入3和2，这里则是设置该复数的虚部为2
        System.out.println("z1=" + z1); //输出3+2i这样的样式

        Complex z2 = new Complex(45, 9); //45+9i,带参构造函数
        System.out.println("z2=" + z2); //输出3+2i这样的样式

        //设z1=a+bi，z2=c+di是任意两个复数，则它们的和是 (a+bi)+(c+di)=(a+c)+(b+d)i
        Complex z3 = z1.add(z2);//复数相加，公式为实部相加，虚部相加
        System.out.printf("%s+%s=%s\n", z1, z2, z3);

        //设z1=a+bi，z2=c+di是任意两个复数，那么它们的积(a+bi)(c+di)=(ac-bd)+(bc+ad)i
        Complex z4 = z1.mul(z2);//复数相乘
        System.out.printf("%s*%s=%s\n", z1, z2, z4);
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // 创建 HashMap 对象 map
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        while(!scanner.hasNext("x")) {
            String input = scanner.nextLine();
            String key = input;
            int value = 1;
            if (map.containsKey(key)) {
                int value1 = map.get(key);
                value += value1;
            }
            map.put(key,value);
        }
        for (String key : map.keySet()) {
            System.out.println(key + "的缺勤次数为" + map.get(key));
        }
        System.out.println("haha");

    }
}
